/**
 * Copyright (C) 2012 The SkyTvOS Project
 * <p/>
 * Version     Date           Author
 * ─────────────────────────────────────
 * 2015年1月14日         Root.Lu
 */

package com.coocaa.launcher.statusplugins.tips;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.coocaa.launcher.framework.launcherhost.statusbar.StatusBarPluginView;
import com.tianci.appstore.R;
import com.tianci.appstore.utils.SkyConstants;

public class StatusPluginTipsView extends StatusBarPluginView {
    private LinearLayout root = null;
    private ImageView image = null;
    private TextView text = null;

    public StatusPluginTipsView(Context context, String name) {
        super(context, name);
        // TODO Auto-generated constructor stub
        root = new LinearLayout(context);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        root.setLayoutParams(params);
        root.setGravity(Gravity.CENTER_VERTICAL);

        image = new ImageView(context);
        image.setImageResource(R.drawable.sp_tips_menu);
        LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams(SkyConstants.Div(50), SkyConstants.Div(50));
        root.addView(image, imageParams);

        text = new TextView(context);
        text.setTextAppearance(context, R.style.statusbar_plugin_text_style);
        text.setTextSize(SkyConstants.Dpi(32));
        text.setText(R.string.sp_tips_menukey);
        setMargin(text);
        root.addView(text);
        addView(root);
    }

    private void setMargin(View view) {
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        params.leftMargin = SkyConstants.Div(20);
        view.setLayoutParams(params);
    }

    @Override
    public int getConfigGravity() {
        // TODO Auto-generated method stub
        return Gravity.LEFT;
    }

}
